<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>快速测试 - 生成数据</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 600px;
            margin: 50px auto;
            padding: 20px;
            text-align: center;
        }
        button {
            font-size: 18px;
            padding: 15px 30px;
            margin: 10px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            color: white;
        }
        .green { background-color: #28a745; }
        .green:hover { background-color: #218838; }
        .blue { background-color: #007bff; }
        .blue:hover { background-color: #0056b3; }
        #result {
            margin-top: 20px;
            padding: 15px;
            border-radius: 5px;
            display: none;
        }
        .success { background-color: #d4edda; color: #155724; display: block; }
        .error { background-color: #f8d7da; color: #721c24; display: block; }
    </style>
</head>
<body>
    <h1>🚀 快速测试工具</h1>
    <p>点击下面的按钮生成测试数据</p>
    
    <button class="green" onclick="createTestData()">
        🎯 生成测试数据（无需登录）
    </button>
    
    <button class="blue" onclick="goToArrangement()">
        📋 查看任务安排页面
    </button>
    
    <div id="result"></div>

    <script>
        async function createTestData() {
            const resultDiv = document.getElementById('result');
            resultDiv.textContent = '正在生成测试数据...';
            resultDiv.className = '';
            resultDiv.style.display = 'block';
            
            try {
                const response = await fetch('http://localhost:8080/system/arrangement/create-test-data', {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    }
                });
                
                if (response.ok) {
                    const data = await response.json();
                    resultDiv.textContent = '✅ ' + data.msg + '\n点击下面的按钮查看新数据！';
                    resultDiv.className = 'success';
                } else {
                    const errorText = await response.text();
                    resultDiv.textContent = '❌ 生成失败: ' + response.status + ' - ' + errorText;
                    resultDiv.className = 'error';
                }
            } catch (error) {
                resultDiv.textContent = '❌ 连接失败: ' + error.message;
                resultDiv.className = 'error';
            }
        }
        
        function goToArrangement() {
            window.location.href = '/#/system/arrangement';
        }
    </script>
</body>
</html>
